home *** CD-ROM | disk | FTP | other *** search
/ Ultra Pack / UltraComputing Partner Applications.iso / SunLabs / tclTK / src / tcl7.4 / tests / eval.test < prev    next >
Encoding:
Text File  |  1994-12-18  |  1.5 KB  |  56 lines

  1. # Commands covered:  eval
  2. #
  3. # This file contains a collection of tests for one or more of the Tcl
  4. # built-in commands.  Sourcing this file into Tcl runs the tests and
  5. # generates output for errors.  No output means no errors were found.
  6. #
  7. # Copyright (c) 1991-1993 The Regents of the University of California.
  8. # Copyright (c) 1994 Sun Microsystems, Inc.
  9. #
  10. # See the file "license.terms" for information on usage and redistribution
  11. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12. #
  13. # @(#) eval.test 1.6 94/12/17 16:19:52
  14.  
  15. if {[string compare test [info procs test]] == 1} then {source defs}
  16.  
  17. test eval-1.1 {single argument} {
  18.     eval {format 22}
  19. } 22
  20. test eval-1.2 {multiple arguments} {
  21.     set a {$b}
  22.     set b xyzzy
  23.     eval format $a
  24. } xyzzy
  25. test eval-1.3 {single argument} {
  26.     eval concat a b c d e f g
  27. } {a b c d e f g}
  28.  
  29. test eval-2.1 {error: not enough arguments} {catch eval} 1
  30. test eval-2.2 {error: not enough arguments} {
  31.     catch eval msg
  32.     set msg
  33. } {wrong # args: should be "eval arg ?arg ...?"}
  34. test eval-2.3 {error in eval'ed command} {
  35.     catch {eval {error "test error"}}
  36. } 1
  37. test eval-2.4 {error in eval'ed command} {
  38.     catch {eval {error "test error"}} msg
  39.     set msg
  40. } {test error}
  41. test eval-2.5 {error in eval'ed command: setting errorInfo} {
  42.     catch {eval {
  43.     set a 1
  44.     error "test error"
  45.     }} msg
  46.     set errorInfo
  47. } "test error
  48.     while executing
  49. \"error \"test error\"\"
  50.     (\"eval\" body line 3)
  51.     invoked from within
  52. \"eval {
  53.     set a 1
  54.     error \"test error\"
  55.     }\""
  56.